import 'package:dart_mock/dart_mock.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:luckin_demo/drawerdemo/theme/colors.dart';

import 'models/food.dart';

class FoodDetialsPage extends StatelessWidget {
  final Food food;
  const FoodDetialsPage({super.key, required this.food});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Column(
        children: [
          Expanded(child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 25),
            child: ListView(
              children: [
                Image.asset(food.imagePath,height: 200,),
                SizedBox(height: 25,),
                Row(
                  children: [
                    SizedBox(width: 5,),
                    Icon(Icons.star,color: Colors.yellow[800],),
                    SizedBox(height: 10,),
                    Text(food.rating,style: TextStyle(
                        color: Colors.grey[600],
                        fontWeight: FontWeight.bold
                    ),)
                  ],
                ),
                SizedBox(height: 10,),
                Text(food.name,style: TextStyle(fontSize:28,
                  fontFamily: "Calibre-Semibold",
                ),),
                SizedBox(height: 10,),
                Text('Description',style: TextStyle(
                  color: Colors.grey[900],
                  fontWeight: FontWeight.bold,
                  fontSize: 18,
                ),),
                Text('Delicate sliced,fresh salmon drapes elegantly over a pillow of perfectly'),
                Container(
                  color: primaryColor,
                  padding: const EdgeInsets.all(25),
                  child: Column(
                    children: [
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('\$' +food.price,style: const TextStyle(
                            color: Colors.white,
                            fontWeight: FontWeight.bold,
                            fontSize: 18
                          ),),
                          ElevatedButton(onPressed: () => Get.defaultDialog(
                            backgroundColor: primaryColor,
                              cancelTextColor:Colors.black,
                              confirmTextColor:Colors.black,
                              buttonColor:Colors.white,
                    title: "Cojiji",
                    content: const Column(
                      children: [
                        Text("是否要加入购物车"),

                      ],
                    ),
                    textConfirm: "确认",
                    textCancel: "取消",
                    onConfirm: (){
                      Get.back() ;
                      Get.snackbar(
                        "提醒",
                        "你已经提交成功",
                      );
                    }
                ), child: Row(
                            children: [
                              Text('Add To Cart'),
                              Icon(Icons.shopping_cart)
                            ],
                          ))
                        ],
                      ),

                    ],
                  ),
                )
              ],
            ),
          ))
        ],
      ),
    );
  }
}
